Storing CDRs Locally on the Device

CDRs generated by the device can be stored locally on the device (hard disk of server platform). CDR files are stored in the /cdr folder, except for SBC Test Call CDRs which are stored in the /cdr-gw folder. New CDRs are stored in a file called "Current". Once this file meets a user-defined criteria—either the maximum file size or the rotation period (whichever is first fulfilled)—a CDR file is created. The file is compressed (if configured) into a ZIP or GZIP file and named according to a user-defined filename using format specifiers (discussed later in this section). The following figure shows an example of locally stored CDR files in the /cdr folder:

Example of Stored CDR Files in /cdr Folder

The device's CDR file storage capacity depends on various user-defined settings:

Maximum number of stored files - configured by the [CDRLocalMaxNumOfFiles] parameter
Maximum file size - configured by the [CDRLocalMaxFileSize] parameter
Interval after which a CDR file is created for the CDRs in the Current file (rotation period) - configured by the [CDRLocalInterval] parameter
File compression, which reduces file size - configured by the [CDRLocalCompression] parameter

At full capacity, the device is capable of storing CDR files for at least 7 days. However, this depends on the settings listed above. Each CDR file is assigned a unique sequence number, which by default, is appended at the end of the filename. You can configure the CDR filename ([CDRLocalFileName] parameter) using format specifiers, as listed in the table below. For example, if a CDR file is created on 25 December 2021 at 14:20:02 and the default format is used ("CDR_%y.%m.%d-%H.%M.%S_%qqqqq.csv"), the filename will be CDR_21.12.25-14.20.02_00010.csv. Whenever you modify the file format, the new format is applied to all existing files (not only future files).

CDR Filename Format Specifiers

Specifier

Replaced by

Example

%a

Abbreviated weekday name.

Thu

%A

Full weekday name.

Thursday

%b

Abbreviated month name.

Aug

%B

Full month name.

August

%C

Year divided by 100 and truncated to integer (00-99).

20

%d

Day of the month (01-31).

23

%e

Day of the month (1-31).

23

%F

Short YYYY-MM-DD date, equivalent to %Y-%m-%d.

2001-08-23

%g

Week-based year, last two digits (00-99).

01

%G

Week-based year.

2001

%h

Abbreviated month name (same as %b).

Aug

%H

Hour in 24-hour time format (00-23).

14

%I

Hour in 12-hour time format (01-12).

02

%j

Day of the year (001-366).

235

%m

Month as a decimal number (01-12).

08

%M

Minute (00-59).

55

%n

New-line character ('\n').

 

%p

AM or PM designation.

PM

%q

The sequence number, where each q represents a digit. The number of digits ('q's) should accommodate the configured maximum number of files [CDRLocalMaxNumOfFiles].

%qqqqq is 00023

%S

Seconds (00-61).

02

%t

Horizontal-tab character ('\t').

 

%u

ISO 8601 weekday as number with Monday as 1 (1-7).

4

%U

Week number with the first Sunday as the first day of week one (00-53).

33

%V

ISO 8601 week number (01-53).

34

%w

Weekday as a decimal number with Sunday as 0 (0-6).

4

%W

Week number with the first Monday as the first day of week one (00-53).

34

%y

Year, short representation using last two digits (00-99).

01

%Y

Year, full representation.

2001

%z

ISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100). If the timezone can't be determined, no characters are shown.

+100

%Z

Timezone name or abbreviation *. If the timezone can't be determined, no characters are shown.

CDT

%%

A % sign.

%

%<hostname>

Device's hostname ( configured in Configuring a Hostname for the Device).

MyHostDR_.062121-11.21.26_00000.csv.zip

You can specify the calls for which you wish to create locally stored CDRs. This is done using Logging Filter rules in the Logging Filters table. For example, you can configure a rule to create locally stored CDRs for traffic belonging only to IP Group #2.

Locally stored CDRs are saved in a comma-separated values file (*.csv), where each CDR is on a dedicated row or line. An example of a CSV file with two CDRs are shown below :

CSV file viewed in Excel:

CSV file viewed in a text editor (Notepad):

The device's CLI provides enhanced support for performing various actions on locally stored CDRs:

To view the CDR column headers corresponding to the CDR data in the CSV file:
SBC CDRs:
(config-system)# cdr
(cdr)# cdr-format show-title local-storage-sbc 
session id,report type,call duration, call end time, call connect time,call start time, call originator, termination reason, call id, srce uri, dest uri
To view stored CDR files:
View all stored CDR files:
# show storage-history
View all stored, unused CDR files:
# show storage-history unused 
To copy stored CDR files to a remote destination:
# copy storage-history cdr-storage-history <filename> to <protocol://destination> 

Where:

filename: name you want to assign the file. Any file extension name can be used, but as the file content is in CSV format, it is recommended to use the .csv file extension.
protocol: protocol over which the file is sent (tftp, http, or https).

For example:

copy storage-history cdr-storage-history my_cdrs.csv to tftp://company.com/cdrs
To delete stored CDR files, see Deleting Locally Stored CDRs and SDRs.
Locally stored CDRs are applicable only to "CALL_END" CDR Report Types and to SBC signaling CDRs.
When the device operates in High-Availability (HA) mode, active and redundant devices maintain their own stored CDRs. In other words, upon an HA switchover the stored CDRs on the active device are not copied to the redundant device (which becomes the new active device). However, you can view the stored CDRs on the redundant device without performing a switchover, by accessing the redundant device from the active device through SSH (or SFTP), as described in Accessing Files on Redundant Device from Active through SSH.
You can customize the CDR fields for local storage. See Customizing CDRs for SBC Calls.
To send locally stored CDR files to a remote third-party server, see Sending Locally Stored CDR Files to Remote SFTP Server.
To download locally stored CDRs through SFTP, see Downloading CDRs through SFTP.
To configure local CDR storage:
1. Open the Logging Filters table (see Configuring Log Filter Rules), and then enable CDR local storage by configuring a log filtering rule with the following settings:
'Filter Type' and 'Value': (as desired)
'Log Destination': Local Storage
'Log Type': CDR
'Mode': Enable
2. Open the Call Detail Record Settings page (Troubleshoot menu > Troubleshoot tab > Call Detail Record folder > Call Detail Record Settings), and then configure the following parameters:
'File Size' [CDRLocalMaxFileSize]: Enter the maximum size (in kilobytes) of the CDR file. When the Current file reaches this size, the device creates a CDR file. However, if the 'Rotation Period' is reached before the file has reached this maximum size, the CDR file is created.
'Number of Files' [CDRLocalMaxNumOfFiles]: Enter the maximum number of CDR files. If this maximum is reached, any new CDR file replaces the oldest CDR file (i.e., FIFO).
'Rotation Period' [CDRLocalInterval]: Enter the periodic duration (in minutes) of how often a CDR file is created from the Current file (even if empty). For example, if configured to 60, a file is created every hour (or before, if the maximum size has been reached).
'CDR File Name' [CDRLocalFileName]: Configure the filename using the format specifiers (as discussed earlier in this section).
'Compression Format' [CDRLocalCompression]: Select the file compression type.

For a detailed description of each parameter, see Syslog, CDR and Debug Parameters.

If the CDR storage feature is enabled and you later change the maximum number of files (using the [CDRLocalMaxNumOfFiles] parameter) to a lower value (e.g., from 50 to 10), the device stores the remaining files (e.g., 40) in its memory as unused files.